<template>
  <view v-if="shenheStatus == 0" class="agency_box">
    <view @click="agencyClick('/agency/agency/lowerLevelShop')">
      <image
        :src="asyncImgs.diyNew.default_img"
        v-if="!config.lowerLevelShopIcon"
        mode="aspectFill"
      ></image>
      <image :src="config.lowerLevelShopIcon" v-else mode="aspectFill"></image>
      <view v-if="!config.lowerLevelShop">下级店铺</view>
      <view v-else>{{ config.lowerLevelShop }}</view>
    </view>
    <view @click="agencyClick('/agency/agency/renewOrder')">
      <image
        :src="asyncImgs.diyNew.default_img"
        v-if="!config.renewOrderIcon"
        mode="aspectFill"
      ></image>
      <image :src="config.renewOrderIcon" v-else mode="aspectFill"></image>
      <view v-if="!config.renewOrder">续费订单</view>
      <view v-else>{{ config.renewOrder }}</view>
    </view>
    <view @click="agencyClick('/pages/union/user-account')">
      <image
        :src="asyncImgs.diyNew.default_img"
        v-if="!config.WithdrawalIcon"
        mode="aspectFill"
      ></image>
      <image :src="config.WithdrawalIcon" v-else mode="aspectFill"></image>
      <view v-if="!config.Withdrawal">提现</view>
      <view v-else>{{ config.Withdrawal }}</view>
    </view>
    <view @click="agencyClick('/agency/agency/commissionDetail')">
      <image
        :src="asyncImgs.diyNew.default_img"
        v-if="!config.commissionDetailIcon"
        mode="aspectFill"
      ></image>
      <image
        :src="config.commissionDetailIcon"
        v-else
        mode="aspectFill"
      ></image>
      <view v-if="!config.commissionDetail">佣金明细</view>
      <view v-else>{{ config.commissionDetail }}</view>
    </view>
    <view @click="agencyClick('/pages/union/withdraw-list')">
      <image
        :src="asyncImgs.diyNew.default_img"
        v-if="!config.WithdrawalLogIcon"
        mode="aspectFill"
      ></image>
      <image :src="config.WithdrawalLogIcon" v-else mode="aspectFill"></image>
      <view v-if="!config.WithdrawalLog">提现记录</view>
      <view v-else>{{ config.WithdrawalLog }}</view>
    </view>
    <view @click="agencyClick('/agency/agency/shopOrder')">
      <image
        :src="asyncImgs.diyNew.default_img"
        v-if="!config.shopOrderIcon"
        mode="aspectFill"
      ></image>
      <image :src="config.shopOrderIcon" v-else mode="aspectFill"></image>
      <view v-if="!config.shopOrder">店铺订单</view>
      <view v-else>{{ config.shopOrder }}</view>
    </view>
  </view>
  <Shenhe v-else-if="shenheStatus == 1"></Shenhe>
</template>

<script>
import Shenhe from "@/components/shenhe/shenhe";
export default {
  components: { Shenhe },
  data() {
    return {
      saas_money: 0,
      list: [
        {
          icon: "../../static/images/diyNew/default_img.png",
          name: "下级店铺",
          event: "navigator",
          url: "/agency/agency/lowerLevelShop",
        },
        {
          icon: "../../static/images/diyNew/default_img.png",
          name: "续费订单",
          event: "navigator",
          url: "/agency/agency/renewOrder",
        },
        {
          icon: "../../static/images/diyNew/default_img.png",
          name: "提现",
          event: "navigator",
          url: `/pages/union/user-account`,
        },
        {
          icon: "../../static/images/diyNew/default_img.png",
          name: "佣金明细",
          event: "navigator",
          url: "/agency/agency/commissionDetail",
        },
        {
          icon: "../../static/images/diyNew/default_img.png",
          name: "提现记录",
          event: "navigator",
          url: "/pages/union/withdraw-list",
        },
        {
          icon: "../../static/images/diyNew/default_img.png",
          name: "店铺订单",
          event: "navigator",
          url: "/agency/agency/shopOrder",
        },
      ],
      config: {},
    };
  },
  onLoad(t) {
    if (t?.money) {
      this.saas_money = t.money;
    }
    this.getConfig();
  },
  methods: {
    agencyClick(path) {
      uni.navigateTo({
        url: path + "?money=" + this.saas_money + "&agency=1"
      });
    },
    // 获取配置信息
    async getConfig() {
      const res = await this.$allrequest.agency.config();
      if (res.code == 0) {
        this.config = res.data;
      }
    },
  },
};
</script>

<style>
.agency_box {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}
.agency_box > view {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 20rpx;
}
.agency_box image {
  width: 80rpx;
  height: 80rpx;
  margin-bottom: 10rpx;
}
</style>
